package cn.ccenjie.wsy.social.alipay.connet;

import cn.ccenjie.wsy.social.alipay.api.Alipay;
import cn.ccenjie.wsy.social.alipay.api.AlipayInfo;
import org.springframework.social.connect.ApiAdapter;
import org.springframework.social.connect.ConnectionValues;
import org.springframework.social.connect.UserProfile;

public class AlipayAdapter implements ApiAdapter<Alipay> {

    @Override
    public boolean test(Alipay alipay) {
        return true;
    }

    @Override
    public void setConnectionValues(Alipay alipay, ConnectionValues connectionValues) {
        AlipayInfo info = alipay.info();
        connectionValues.setDisplayName(info.getNickName());
        connectionValues.setImageUrl(info.getAvatar());
        connectionValues.setProviderUserId(info.getUserId());
    }

    @Override
    public UserProfile fetchUserProfile(Alipay alipay) {
        return null;
    }

    @Override
    public void updateStatus(Alipay alipay, String s) {

    }
}
